]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Don't reset y position of expanded notifications when updating them
authorMarina Zhurakhinskaya <marinaz@redhat.com>
Thu, 13 Jan 2011 01:05:36 +0000 (20:05 -0500)
committerMarina Zhurakhinskaya <marinaz@redhat.com>
Tue, 18 Jan 2011 20:08:46 +0000 (15:08 -0500)
This fixes the problem of chat notifications collapsing and then expanding
again when receiving multiple messages in the expanded new notification.

https://bugzilla.gnome.org/show_bug.cgi?id=629557

js/ui/messageTray.js

index 1e896a9c5d49a62c64cc5298e454d779aa4f742d..c158c037ab1006fdfb21cd13313606c24280804f 100644 (file)
@@ -1500,23 +1500,40 @@ MessageTray.prototype = {
 
     _updateShowingNotification: function() {
         Tweener.removeTweens(this._notificationBin);
-        this._tween(this._notificationBin, '_notificationState', State.SHOWN,
-                    { y: 0,
-                      opacity: 255,
-                      time: ANIMATION_TIME,
-                      transition: 'easeOutQuad',
-                      onComplete: this._showNotificationCompleted,
-                      onCompleteScope: this
-                    });
 
         // We auto-expand notifications with CRITICAL urgency.
-        // We call _expandNotification() again on the notifications that
-        // are expanded in case they were in the process of hiding and need
-        // to re-expand.
+        // We use Tweener.removeTweens() to remove a tween that was hiding the notification we are
+        // updating, in case that notification was in the process of being hidden. However,
+        // Tweener.removeTweens() would also remove a tween that was updating the position of the
+        // notification we are updating, in case that notification was already expanded and its height
+        // changed. Therefore we need to call this._expandNotification() for expanded notifications
+        // to make sure their position is updated.
         if (this._notification.urgency == Urgency.CRITICAL || this._notification.expanded)
-            // This will overwrite the y tween, but leave the opacity
-            // tween, and so the onComplete will remain as well.
             this._expandNotification(true);
+
+        // We tween all notifications to full opacity. This ensures that both new notifications and
+        // notifications that might have been in the process of hiding get full opacity.
+        //
+        // We tween any notification showing in the banner mode to banner height (this._notificationBin.y = 0).
+        // This ensures that both new notifications and notifications in the banner mode that might
+        // have been in the process of hiding are shown with the banner height.
+        //
+        // We use this._showNotificationCompleted() onComplete callback to extend the time the updated
+        // notification is being shown.
+        //
+        // We don't set the y parameter for the tween for expanded notifications because
+        // this._expandNotification() will result in getting this._notificationBin.y set to the appropriate
+        // fully expanded value.
+        let tweenParams = { opacity: 255,
+                            time: ANIMATION_TIME,
+                            transition: 'easeOutQuad',
+                            onComplete: this._showNotificationCompleted,
+                            onCompleteScope: this
+                          };
+        if (!this._notification.expanded)
+            tweenParams.y = 0;
+
+        this._tween(this._notificationBin, '_notificationState', State.SHOWN, tweenParams);
    },
 
     _showNotificationCompleted: function() {